package com.af.example;

import java.util.Date;
import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * @author : zhenyun.su
 * @comment : 提供输出字符
 * @since : 2022/5/8
 */

public class AfExampleHello extends AfBaseExample {

    public AfExampleHello(TimeUnit timeUnit, Integer timeOut) {
        super(timeUnit, timeOut);
    }

    public static AfExampleHello milliOf(Integer timeOut){
        return new AfExampleHello(TimeUnit.MICROSECONDS, timeOut);
    }

    public static AfExampleHello secondsOf(Integer timeOut){
        return new AfExampleHello(TimeUnit.SECONDS, timeOut);
    }
    public static AfExampleHello minutesOf(Integer timeOut){
        return new AfExampleHello(TimeUnit.MINUTES, timeOut);
    }

    public String hello(String name) {
        trySleep();
        return "hello: " + name;
    }

    public String welcome(String name) {
        trySleep();
        return "welcome: " + name;
    }

    public static void main(String[] args) {
        AfExampleHello afExampleHello = AfExampleHello.secondsOf(5);
        afExampleHello.setDebug(true);
        System.out.println(afExampleHello.hello("AfExampleHello"));
        System.out.println(afExampleHello.welcome("AfExampleHello"));
    }
}
